﻿//===============================================================================
//	COpenRewardDialogue
//	打开奖励对话框
//===============================================================================

#include "COpenRewardDialogue.h"


//-------------------------------------------------------------------------------
COpenRewardDialogue::COpenRewardDialogue(uint32_t uid, uint32_t pn)
	: BaseMessage(uid, pn)
{
	_safe_guard_begin;
	_safe_guard_end;
}

//-------------------------------------------------------------------------------
COpenRewardDialogue::~COpenRewardDialogue(void)
{

}

//-------------------------------------------------------------------------------
void COpenRewardDialogue::SetRewardDialogue(RewardData& rewardData)
{
	_safe_guard_begin;

	m_jv["rwdType"] = rewardData.GetRewardType();

	RewardInfo* pData = rewardData.GetRewardInfo();
	_safe_check(pData);

	Json::Value jvData;
	jvData.clear();

	Json::Value jvItem;

	uint32_t size = rewardData.GetRewardInfoSize();

	for (uint32_t i = 0; i < size; ++i )
	{
		jvItem.clear();
		jvItem["id"] = pData[i].mRewardId;
		jvItem["num"] = pData[i].mRewardNum;
		
		jvData.append(jvItem);
	}

	m_jv["rwdData"] = jvData;
	m_jv["ret"] = 0;

	_safe_guard_end;
}
